﻿Imports System.Data
Imports System.Data.Odbc
Imports WSEntidades
Imports Utilerias
Imports Npgsql
Imports MySql.Data.MySqlClient
Public Class ContactoClienteFact
    Public Shared Function Build(ByVal dr As MySqlDataReader) As ContactoClienteBE
        Dim tmpContactoCliente As ContactoClienteBE = New ContactoClienteBE()
        Try
            With tmpContactoCliente
                .IdContactoCliente = convertDTFromDb.convertInt32(dr.Item("IdContactoCliente"))
                .IdCliente = convertDTFromDb.convertInt32(dr.Item("IdCliente"))
                .Rfc = convertDTFromDb.ConvertString(dr.Item("Rfc"))
                .Telefono = convertDTFromDb.ConvertString(dr.Item("Telefono"))
                .Contacto = convertDTFromDb.ConvertString(dr.Item("Contacto"))
                .Direccion = convertDTFromDb.ConvertString(dr.Item("Direccion"))
                Select Case convertDTFromDb.ConvertString(dr.Item("Status"))
                    Case "A"
                        .Status = ContactoClienteBE.StatusContactoCliente.Activo
                    Case "I"
                        .Status = ContactoClienteBE.StatusContactoCliente.Inactivo
                    Case Else
                        .Status = ContactoClienteBE.StatusContactoCliente.Inactivo
                End Select
            End With
            Return tmpContactoCliente
        Catch ex As Exception
            Throw
        Finally
            tmpContactoCliente = Nothing
        End Try
    End Function
End Class
